package com.company.cloud.gateway.component.utils;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSON;
import com.company.cloud.gateway.component.config.ZuulRouteEntity;

import cn.hutool.core.codec.Base64;

public class ZuulTestUtils {
	
	
	public static void zuulRoute() {
		ZuulRouteEntity zre1=new ZuulRouteEntity();
		zre1.setId("cms-center");
		zre1.setPath("/cms/**");
		zre1.setServiceId("cms-center");
		zre1.setStripPrefix(true);
		zre1.setApiName("cms");
		zre1.setCustomSensitiveHeaders(true);
		zre1.setEnabled(true);
		
		ZuulRouteEntity zre2=new ZuulRouteEntity();
		zre2.setId("user-center");
		zre2.setPath("/user/**");
		zre2.setServiceId("user-center");
		zre2.setStripPrefix(true);
		zre2.setApiName("user");
		zre2.setCustomSensitiveHeaders(true);
		zre2.setEnabled(true);
		
		List<ZuulRouteEntity> list=new ArrayList<ZuulRouteEntity>();
		list.add(zre1);
		list.add(zre2);
		
		System.out.println(JSON.toJSONString(list));
	}

	public static void main(String[] args) {
		
		String s="测试数据22!sss";
		System.out.println(s);
		try {
			String s1= URLEncoder.encode(s, "UTF-8");
			System.out.println(s1);
			String s2= URLDecoder.decode(s1, "UTF-8");
			System.out.println(s2);
			
			String base1= Base64.encode(s, "UTF-8");
			System.out.println(base1);
			System.out.println(URLEncoder.encode(base1, "UTF-8"));
			String base2=Base64.decodeStr(base1, "UTF-8");
			System.out.println(base2);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		
		
		

	}

}
